from django.test import TestCase

# Create your tests here.
#注册
# def tregister(request):
#     if request.method=="POST":
#         back_dic = {"code": '', "msg": ""}
#         print(request.POST)
#         username=request.POST.get('username')
#         password=request.POST.get('password')
#         confirmpassword=request.POST.get('confirmpassword')
#         teanum=request.POST.get('teanum')
#         if not password==confirmpassword:
#             back_dic["code"]=201
#             back_dic["msg"]="两次密码不一致！！！"
#             return JsonResponse(back_dic)
#         else:
#             user_obj=models.TeacherInfo.objects.filter(teaname=username).first()
#             if not user_obj:
#                 models.TeacherInfo.objects.create(teanum=teanum,teaname=username,password=password)
#                 back_dic["code"] = 200
#                 back_dic["url"]='/tlogin/'
#                 return JsonResponse(back_dic)
#             back_dic["code"] = 202
#             back_dic["msg"] = "请填写完整or用户已存在！！！"
#             return JsonResponse(back_dic)
#     return render(request,'tregister.html')
import os
import sys


if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "diploma_project.settings")
    import django
    django.setup()
    from wechat_mini import models
    # #测试
    # classname = 's101'
    # res=models.ClassRoom.objects.filter(classid=classname).values('rowcolumn','rowline').first()
    # # for i in range(1, 10):
    # #     for j in range(1, 11):
    # #         print('{},{}'.format(i,j)
    # row=int(res['rowline'])
    # col=int(res['rowcolumn'])
    # b=True
    # l=[]
    # list1=[]
    # for i in range(1,row):
    #     for j in range(1,col):
    #         # < img
    #         # src = {}
    #         # style = 'width:50px;height:20px' > < / img >
    #         # "<button style='width:100px;height:50px;margin:5px 5px'>{},{}</button>&nbsp;&nbsp;"
    #         list1.append('{},{}'.format(i,j))
    # # print(type(res['rowcolumn']),res['rowline'])
    # l.append('{},{}'.format(r,c))
    # print(type(l[0]))
    # print(type(list1))
    # print(list1[0])
    # for h in list1:
    #     k,v=list1[h].strip('').split(',')
    #     print(k,v)
    # def func():
    # kaoqin_obj = models.KaoQin.objects.filter(stuname='温啓辉').first()
    # stu_obj=models.StudentInfo.objects.filter(snum=kaoqin_obj.stunum).first()
    # print(kaoqin_obj.avatar)
    # print(stu_obj.avatar)
    # # func()
    # # res=models.TestInfo.objects.create(phone='13725654531')
    # res=models.TestInfo.objects.filter(phone='15819272349').first()
    # print('电话号码为:'+res.phone)
    classname='s101'
    qinjia_obj = models.StudentLeave.objects.filter(classnum=classname).first()
    print(qinjia_obj.stunum)
